package com.wyj;

import com.wyj.pojo.SpinResult;
import jdk.nashorn.internal.ir.Assignment;
import lombok.val;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.relational.core.sql.In;
import sun.lwawt.macosx.CSystemTray;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

@SpringBootTest
public class fetchSelfDataTexts {

    @Test
    public void text01() {
        val result = new SpinResult();

        //调用逻辑一 向集合当中进行赋值
        assignmentIn(result);

        //调用逻辑二 从集合当中获取值
        assignmentOut(result);
    }
    private void assignmentIn(SpinResult result) {
        HashMap<Object,Object> wyj = new HashMap<>();
        wyj.put(1,1);
        wyj.put(2,1);
        wyj.put(3,1);

        result.fetchSelfData().put("wyj",wyj);
    }
    private void assignmentOut(SpinResult result) {
        HashMap<Object,Object> wyj = (HashMap<Object, Object>) result.fetchSelfData().getOrDefault("wyj",new HashMap<>());

        wyj.put(4,1);
        wyj.put(5,1);

        result.fetchSelfData().put("wyj",wyj);

        System.out.println(result.fetchSelfData().get("wyj"));

    }

    @Test
    public void text02() {
        SpinResult spinResult = new SpinResult();

        //逻辑一 在value值当中进行赋值
        assignmentNums(spinResult);

        //累加输出结果
        addNums(spinResult);


        System.out.println(spinResult.fetchSelfData().get("nums"));
    }

    public void assignmentNums(SpinResult result) {
        Object nums = result.fetchSelfData().put("nums", 0);
    }

    public void addNums(SpinResult result) {
        Integer nums = (Integer)result.fetchSelfData().get("nums");
        nums++;
        nums++;
        result.fetchSelfData().put("nums",nums);
    }

    @Test
    public void text03() {
        int a = 2;
        Integer b = 2;
        System.out.println(a == b);
    }

}
